const state = {
  userInfo: JSON.parse(localStorage.getItem('userInfo') || '{}')  
}

const mutations = {
  updateUserInfo(state,userInfo) {
    state.userInfo = userInfo,
    localStorage.setItem('userInfo', JSON.stringify(userInfo))
  }
}

const actions =  {
  
}

const getters = {
  userId(state) {
    return state.userInfo.id
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
}